#ifndef			_GAME
#define			_GAME

#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>
#include <SDL/SDL_image.h>
#include <map>
#include <list>
#include "consts.h"

unsigned int    randuint(unsigned int max);

typedef struct		s_coord
{
  long double		x;
  long double		y;
}			Coord;

class			Game
{
  SDL_Surface*		_screen;
  Coord			_cam;
  int			_zoom;
  Coord			_mouse;
  int			_clicked;
  bool			_paused;
  int			_edges;
  TTF_Font*		_font;
  char			_title[256];

  void			cam_move(int x, int y);
  void			manage_mouse(SDL_Event*);
  int			manage_keyboard();
  void			applyCameraZoom(Coord& cursorPos, int newZoom);
  void			updateMousePos();
 public:
  Game(int);

  bool			belongs(int, int);
  void			font_load();
  void			text(const char* t, SDL_Color* c, int, int);
  bool			init_SDL();
  void			cls();
  int			timer_countdown(int *start, int seconds);
  void			setEdges(int);
  int			getEdges() const;
  bool			paused() const;
  int			get_timer();
  char*			getTitle();
  SDL_Surface*		getScreen() const;
  int			getZoom() const;
  Coord			getCam() const;
  bool			clicked() const;
  int			getMx() const;
  int			getMy() const;
  void			wait();
  int			manage_keys();
  void			ini_keys();
  void			dot32(Uint16 x, Uint16 y, Uint32 col);
  void			dot32(SDL_Surface* dst, Uint16 x, Uint16 y, Uint32 col);
  Uint32		getDot32(SDL_Surface* dst, Uint16 x, Uint16 y);
  void			maxDot32(SDL_Surface* dst, Uint16 x, Uint16 y, Uint32 col);
  void			dot(Uint16 x, Uint16 y, Uint32 col);
  void			sync();
};

#endif
